package com.llho.util;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;

import com.llho.core.dao.ProductDAO;
import com.llho.core.domain.Image;
import com.llho.core.domain.Product;

public class testDAO{

	public static void main(String[] args) {
		String[] path = {"WEB-INF/config/SpringBeans.xml"};
		ApplicationContext ctx = new ClassPathXmlApplicationContext(path);
		
		ProductDAO pDAO = (ProductDAO) ctx.getBean("productDAO");
		
		Product product = new Product();
		
		Image image = new Image();
		image.setUrl("images/product/123.gif");
		image.setProduct(product);
		
		//product.addImage(image);
		product.setName("test");
		product.setDescription("test");
		product.setPrice(123L);
		
		pDAO.addNew(product);
	}
}
